package com.snail.clouds.framework.api;

/**
 * 响应码枚举
 */
public enum ResponseCode {
    // 成功
    SUCCESS(200, "操作成功"),
    
    // 通用错误码 400-499
    BAD_REQUEST(400, "请求参数错误"),
    UNAUTHORIZED(401, "未授权"),
    FORBIDDEN(403, "禁止访问"),
    NOT_FOUND(404, "资源不存在"),
    METHOD_NOT_ALLOWED(405, "请求方法不被允许"),
    REQUEST_TIMEOUT(408, "请求超时"),
    
    // 服务器错误 500-599
    INTERNAL_ERROR(500, "服务器内部错误"),
    NOT_IMPLEMENTED(501, "功能未实现"),
    SERVICE_UNAVAILABLE(503, "服务不可用"),
    
    // 业务相关错误码 1000-1999
    USER_NOT_EXIST(1000, "用户不存在"),
    USER_ACCOUNT_LOCKED(1001, "用户账户已被锁定"),
    USER_PASSWORD_ERROR(1002, "密码错误"),
    USER_ACCOUNT_EXPIRED(1003, "用户账户已过期"),
    
    CLOUD_ACCOUNT_NOT_EXIST(1100, "云存储账户不存在"),
    CLOUD_ACCOUNT_ERROR(1101, "云存储账户异常"),
    CLOUD_SERVICE_ERROR(1102, "云存储服务异常"),
    
    FILE_NOT_FOUND(1200, "文件不存在"),
    FILE_ACCESS_DENIED(1201, "文件访问被拒绝"),
    FILE_STORAGE_EXCEEDED(1202, "存储空间不足");
    
    private final int code;
    private final String message;
    
    ResponseCode(int code, String message) {
        this.code = code;
        this.message = message;
    }
    
    public int getCode() {
        return code;
    }
    
    public String getMessage() {
        return message;
    }
}